const company = [{
		required: true,
		message: '维保单位不能为空',
		trigger: 'blur'
	},

]

const personStatus = [{
		required: true,
		message: '人员状态不能为空',
		trigger: 'blur'
	},

]

//身份证
const identity = (rule, value, callback) => {
	if (!value) {
		return callback(new Error('身份证号码不能为空'));
	} else {
		const reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/
		console.log(reg.test(value));
		if (reg.test(value)) {
			callback();
		} else {
			return callback(new Error('请输入正确的身份证号码'));
		}
	}
};

const homeAddress = [{
		required: true,
		message: '家庭住址不能为空',
		trigger: 'blur'
	},
	{
		min: 3,
		max: 16,
		message: '家庭住址 3 到 16 个字符之间',
		trigger: 'blur'
	},
]

const pactStartTime = [{
		required: true,
		message: '合同开始时间不能为空',
		trigger: 'blur'
	},
]

const pactEndTime = [{
		required: true,
		message: '合同结束时间不能为空',
		trigger: 'blur'
	},
]


const account = [{
		required: true,
		message: '用户账号不能为空',
		trigger: 'blur'
	},
	{
		min: 5,
		max: 12,
		message: '账号长度在 5 到 12 个字符之间',
		trigger: 'blur'
	},
]
		
const trueName = [{
		required: true,
		message: '用户真实姓名不能为空',
		trigger: 'blur'
	},
	{
		min: 2,
		max: 6,
		message: '名称长度在 2 到 6 个字符之间',
		trigger: 'blur'
	},
]

const pass = [{
		required: true,
		message: '用户密码不能为空',
		trigger: 'blur'
	},
	{
		min: 4,
		max: 12,
		message: '密码长度在 4 到 12 个字符之间',
		trigger: 'blur'
	},
]

const oldPass = [{
		required: true,
		message: '旧密码不能为空',
		trigger: 'blur'
	},
	{
		min: 4,
		max: 12,
		message: '密码长度在 4 到 12 个字符之间',
		trigger: 'blur'
	},
]


const phoneNum = (rule, value, callback) => {
	if (!value) {
		return callback(new Error('手机号码不能为空'));
	} else {
		const reg =
			/^(0?(13[0-9]|15[012356789]|17[013678]|18[0-9]|14[57])[0-9]{8})|(400|800)([0-9\\-]{7,10})|(([0-9]{4}|[0-9]{3})(-| )?)?([0-9]{7,8})((-| |转)*([0-9]{1,4}))?$/
		if (reg.test(value)) {
			callback();
		} else {
			return callback(new Error('请输入正确的手机号码'));
		}
	}
};


export {
	company,
	personStatus,
	identity,
	homeAddress,
	pactStartTime,
	pactEndTime,
	account,
	trueName,
	phoneNum,
	pass,
	oldPass
}
